package com.qfedu.edu.config;

import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.StringHttpMessageConverter;

import java.nio.charset.Charset;

/**
 * @author xiaobobo
 * @title: AppConfig
 * @projectName CD-Java-FY-2401-Springboot-Parent
 * @description: TODO
 * @date 2024/9/9  9:38
 */
@SpringBootConfiguration
@ComponentScan(basePackages = {"com.qfedu.edu"})
public class AppConfig {
   //你就可以写配置啦
    //我们要配置消息转换器 默认Jackson 现在要换成 fastJSON

   /* @Bean
    public FastJsonHttpMessageConverter fastJsonHttpMessageConverter(){
        FastJsonHttpMessageConverter fastJsonHttpMessageConverter = new FastJsonHttpMessageConverter();
        fastJsonHttpMessageConverter.setDefaultCharset(Charset.forName("UTF-8"));
        return fastJsonHttpMessageConverter;
    }*/

    /**
     * String类型的消息转换器
     * @return
     */
    /*@Bean
    public StringHttpMessageConverter stringHttpMessageConverter(){
        StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter(Charset.forName("UTF-8"));
        return stringHttpMessageConverter;
    }*/

}
